{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "request": {
      "type": "object",
      "description": "Object containing information about the request.",
      "isRequired": true,
      "llm_type": {
        "type": "string",
        "description": "Specifies the nature of the interaction with the model. A 'chat' type indicates a conversational approach, potentially involving multiple exchanges, and is structured to facilitate ongoing interaction. In contrast, a 'completion' type represents a direct response to a specific prompt, often used to generate text based on the initial input, without the context of a back-and-forth conversation. The structure of both the request and response will vary accordingly.",
        "enum": ["chat", "completion"],
        "isRequired": true
      },
      "model": {
        "type": "string",
        "description": "AI model being used.",
        "isRequired": true
      },
      "provider": {
        "type": "string",
        "description": "Provider of the AI model, e.g., OpenAI.",
        "isRequired": true
      },
      "prompt": {
        "type": "string",
        "description": "The initial text input provided to the AI, prompting it to generate a response. This is used only for 'completion' requests.",
        "default": null
      },
      "max_tokens": {
        "type": "number",
        "description": "Maximum tokens for the AI model response.",
        "default": null
      },
      "temperature": {
        "type": "number",
        "description": "Temperature setting for the AI model.",
        "default": null
      },
      "top_p": {
        "type": "number",
        "description": "Top P setting for the AI model.",
        "default": null
      },
      "n": {
        "type": "number",
        "description": "Number of completions to generate.",
        "default": null
      },
      "stream": {
        "type": "boolean",
        "description": "Whether to stream the response or not.",
        "default": null
      },
      "stop": {
        "type": "string",
        "description": "Stop sequence for the AI model.",
        "default": null
      },
      "presence_penalty": {
        "type": "number",
        "description": "Penalty for presence in the AI model response.",
        "default": null
      },
      "frequency_penalty": {
        "type": "number",
        "description": "Penalty for frequency in the AI model response.",
        "default": null
      },
      "logprobs": {
        "type": "number",
        "description": "Log probabilities setting for the AI model.",
        "default": null
      },
      "best_of": {
        "type": "number",
        "description": "Best of setting for the AI model.",
        "default": null
      },
      "logit_bias": {
        "type": "object",
        "description": "Bias in logits for the AI model.",
        "default": null
      },
      "user": {
        "type": "string",
        "description": "User information for the request.",
        "default": null
      },
      "messages": {
        "type": "array",
        "description": "Used in 'chat' interactions, this field holds the conversation's content, structured as either a single message or an array of sequential messages, adapting to the flow of the conversation.",
        "default": null,
        "items": {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "description": "Role of the message sender.",
              "default": null
            },
            "content": {
              "type": "string",
              "description": "Textual content of the message.",
              "default": null
            },
            "function_call": {
              "type": "object",
              "description": "Object containing information about a function call within the message, if applicable.",
              "default": null,
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Specifies a function called within the message, if applicable.",
                  "default": null
                },
                "arguments": {
                  "type": "object",
                  "description": "Arguments used in the function call, if any, within the message.",
                  "default": null
                }
              }
            }
          }
        }
      }
    },
    "response": {
      "type": "object",
      "description": "Object containing information about the response.",
      "default": null,
      "completions": {
        "type": "array",
        "description": "Text generated by the model in response to a prompt. Used exclusively for 'completion' requests, this may include multiple iterations based on the same prompt, facilitating the selection of the most suitable output.",
        "default": null,
        "items": {
          "type": "string"
        }
      },
      "message": {
        "type": "object",
        "description": "Used in 'chat' interactions, this field holds the conversation's content, structured as either a single message or an array of sequential messages, adapting to the flow of the conversation.",
        "default": null,
        "properties": {
          "role": {
            "type": "string",
            "description": "Role of the message sender.",
            "default": null
          },
          "content": {
            "type": "string",
            "description": "Textual content of the message.",
            "default": null
          },
          "function_call": {
            "type": "object",
            "description": "Object containing information about a function call within the message, if applicable.",
            "default": null,
            "properties": {
              "name": {
                "type": "string",
                "description": "Specifies a function called within the message, if applicable.",
                "default": null
              },
              "arguments": {
                "type": "object",
                "description": "Arguments used in the function call, if any, within the message.",
                "default": null
              }
            }
          }
        }
      },
      "error": {
        "type": "object",
        "additionalProperties": false,
        "description": "Object containing information about any error that occurred during the request.",
        "default": null,
        "properties": {
          "code": {
            "type": "string",
            "description": "An error code representing the type of error.",
            "default": null
          },
          "message": {
            "type": "string",
            "description": "The error message, providing details of the error that occurred.",
            "default": null
          }
        }
      }
    }
  }
}
